var jq = jQuery.noConflict();

//购物车填入商品
function fillBuyCar(productList,stockMap){
    //总费用
    var cost = 0;
    //购物车商品
    jq('.cars').html('');
    jq('.un_login').html('');
    //购物车商品数量
    if(productList == '' || productList == null){
        jq('.i_car>.car_t').html('购物车 [ <span>0</span> ]');
    }else{
        jq('.i_car>.car_t').html('购物车 [ <span>'+productList.length+'</span> ]');
        jq.each(productList,function(index,product){

            var pid = product.id;
            var num = stockMap[pid+''];
            num=parseInt(num);
            var stock=parseInt(product.stock);
            // alert(stock);
            var li = jq(
                '<li>' +
                '     <div class="img"><a href="Product.html?id='+product.id+'"><img src="https://tzz-chuan.oss-cn-hangzhou.aliyuncs.com/'+product.fileName+'" width="58" height="58" /></a></div>' +
                '     <div class="name"><a href="Product.html?id='+product.id+'">'+product.name+'</a></div>' +
                '     <div class="price" price="'+product.price+'"><font color="#ff4e00">￥'+product.price+' <!--</font><span style="margin-left: 50px">X</span>--></div>' +
                '     <input type="text" style="height: 20px;position:relative;left: 206px;top:-19px;font-size:15px" height="25px" value="'+num+'" readonly class="n_ipt" />' +
                // '     <input type="button" style="position:relative;top:-20px" class="n_btn_1 num2" onclick="addUpdateCar2(jq(this));" />' +
                // '     <input type="button" style="position:relative;right:57px;top:-20px" class="n_btn_2 num2" onclick="jianUpdateCar2(jq(this));" />' +
                // '     <input type="hidden" value="'+stock+'" pid="'+product.id+'" />' +
                '</li>');
            jq('.cars').append(li);
            cost = cost + parseInt(product.price) * num;
        });

    }
    //填入总费用
    jq('.price_sum').html('共计&nbsp; <font color="#ff4e00">￥</font><span>'+cost+'</span>');
    jq('.price_a').html('<a href="BuyCar.html">去购物车结算</a>');

}


